import { getLogs } from '@/api/logs'
import {getToken} from "@/utils/auth";

const state = {
  token: getToken()
}

const mutations = {
  SET_TOKEN: (state, token) => {
    state.token = token
  }
}

const actions = {
  // logs getInfo
  getInfo({ commit }, data) {
    const { pageNum, pageSize } = data
    return new Promise((resolve, reject) => {
      getLogs(pageNum, pageSize).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
